<template>
  <div class="resident-detail-page">
    <nav-bar :title="title"></nav-bar>
    <div class="resident-detail-main page-main" style="margin-top: 44px">
      <van-sticky class="page-scroll" :offset-top="44">
        <!-- 1：更新  2：审核  3：采集 -->
        <p class="resident-detail-time" v-if="formParams.updateTime">
          <template v-if="$route.query.queryType === '1'">上次更新时间：</template>
          <template v-if="$route.query.queryType === '2'">上次审核时间：</template>
          <template v-if="$route.query.queryType === '3'">上次采集时间：</template>
          {{ formParams.updateTime }}
        </p>
        <van-form input-align="right" :label-width="120">
          <div class="van-collapse">
            <van-field
              readonly
              label-class="van-cell__title_gray"
              required
              v-model="formParams.placeName"
              label="所属场所"
            />
            <van-field
              readonly
              label-class="van-cell__title_gray"
              required
              v-model="formParams.buildName"
              label="楼栋"
            />
            <van-field
              readonly
              label-class="van-cell__title_gray"
              required
              v-model="formParams.unitName"
              label="单元"
            />
            <van-field
              readonly
              label-class="van-cell__title_gray"
              required
              v-model="formParams.floorName"
              label="楼层"
            />
            <van-field
              readonly
              label-class="van-cell__title_gray"
              required
              v-model="formParams.houseName"
              label="房屋名称"
            />
            <van-field
              readonly
              label-class="van-cell__title_gray"
              required
              v-model="formParams.roomNo"
              label="房间号"
            />
            <van-field
              readonly
              label-class="van-cell__title_gray"
              required
              v-model="formParams.houseTypeName"
              label="房屋类别"
            />
            <van-field
              readonly
              label-class="van-cell__title_gray"
              required
              v-model="formParams.houseStateName"
              label="房屋使用形式"
            />
            <van-field
              readonly
              label-class="van-cell__title_gray"
              required
              v-model="formParams.housePropertyName"
              label="房屋性质"
            />
            <van-field readonly label-class="van-cell__title_gray" v-model="formParams.houseNum" label="房间数" />
            <van-field readonly label-class="van-cell__title_gray" v-model="formParams.houseArea" label="房屋面积" />
            <van-field readonly label-class="van-cell__title_gray" label="备注" :border="false" />
            <van-field
              readonly
              v-model="formParams.remark"
              rows="5"
              autosize
              type="textarea"
              show-word-limit
              :border="false"
              input-align="left"
              class="van-field__value--textarea-lightgray"
            />
          </div>
          <div style="padding: 16px"></div>
        </van-form>
      </van-sticky>
    </div>
  </div>
</template>
<script>
import Resident from '@/api/resident'
export default {
  data() {
    return {
      title: '房屋基础信息详情',
      formParams: {}
    }
  },
  created() {
    this.getDetail()
  },
  methods: {
    // 获取详情
    getDetail() {
      Resident.BaseInfo.houseDetail({
        houseCode: this.$route.query.houseCode,
        queryType: this.$route.query.queryType
      }).then(res => {
        const { status, data } = res.data
        if (status === 0) {
          this.formParams = { ...data }
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
@import '~@/assets/style/resident/detail.less';
</style>
